Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.37k stars 976 forks source link

Creating a custom Transport fails: TypeError: Tone.Transport is not a constructor #1127

Closed mypelz closed 1 year ago

mypelz commented 1 year ago

Following documentation a custom Transport can be constructed by calling new Tone.Transport(); Either in typescript or in a plain javascript prototype - construction fails with: TypeError: Tone.Transport is not a constructor. I am confused :-)

trying with most recent version of (the great) tonejs library...

tambien commented 1 year ago

Seems like an error of the documentation, Transport is a singleton or tied to a Context If you created a new Context, it would also create a new transport which is accessible from context.transport

mypelz commented 1 year ago

Thanx for the clarification. I recommend strongly to update the documentation here. I was stumbling upon this as I saw this as a possibility to create independent transports of several players, that can manage their dedicated "Transports". In the meanwhile I learned that Transport is unique and that rather Tone.Part should be used to fulfill my requirement. I think it would be good to mention this explicitly in the documentation of Tone.Transport.